<?php

class Default_Model_Productitem extends Zend_Db_Table_Abstract{
    public $_name="product_item";                    
    public function getDataDisplay(){
		$query = $this->select()
                        ->setIntegrityCheck(false)
                        ->from(array('p'=>$this->_name),array('p.itemId','p.itemName'))
                        ->where('p.display = 1')
                        ->order('p.ord asc'); 
        return $this->fetchAll($query);
    }
    public function getDataByCatId($id){
        $query = $this->select()
                        ->setIntegrityCheck(false)
                        ->from(array('p'=>$this->_name),array('p.itemId','p.itemName'))
                        ->where('p.catId = '.(int)$id)
                        ->where('p.display = 1')                        
                        ->order('p.ord asc'); 
        return $this->fetchAll($query);  
    }
    public function getDataByItemId($id){
        $query = $this->select()
                        ->setIntegrityCheck(false)
                        ->from(array('p'=>$this->_name),array('p.itemId','p.itemName'))
                        ->where('p.itemId = '.(int)$id)
                        ->where('p.display = 1')                        
                        ->order('p.ord asc'); 
        return $this->fetchAll($query);  
    }
    public function updateCat($data,$id){
        $this->update($data,"id=$id");          
    }
}